package com.liang.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: XIAOLIANG
 * Date: 2021/5/7
 * Time: 21:22
 * Description: No Description
 */
@Slf4j
@Component
public class MyHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        log.debug("开始执行插入填充");
        this.setFieldValByName("createTime",new Date(),metaObject);
        this.setFieldValByName("deleted",0,metaObject);

    }

    @Override
    public void updateFill(MetaObject metaObject) {
        log.debug("开始执行更新填充");

//        this.setFieldValByName("updateTime",new Date(),metaObject);

    }
}
